if (functions == NULL || functions->executable_funcs[index] == NULL)
return PCRE2_ERROR_JIT_BADOPTION;
+/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT,
+free the memory that was obtained. */
+
+if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0)
+ {
+ match_data->memctl.free((void *)match_data->subject,
+ match_data->memctl.memory_data);
+ match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT;
+ }
+
/* Sanity checks should be handled by pcre2_match. */
arguments.str = subject + start_offset;
arguments.begin = subject;
PTR(dat_context), dfa_workspace, DFA_WS_DIMENSION);
}
- else if ((pat_patctl.control & CTL_JITFAST) != 0)
+ else if ((pat_patctl.control & CTL_JITFAST) != 0 &&
+ (dat_datctl.options & PCRE2_NO_JIT) == 0)
PCRE2_JIT_MATCH(capcount, compiled_code, pp, ulen, dat_datctl.offset,
dat_datctl.options, match_data, PTR(dat_context));
if (emoption != 0)
{
- if ((pat_patctl.control & CTL_JITFAST) != 0)
+ if ((pat_patctl.control & CTL_JITFAST) != 0 &&
+ (dat_datctl.options & PCRE2_NO_JIT) == 0)
{
PCRE2_JIT_MATCH(rc, compiled_code, pp, arg_ulen, dat_datctl.offset,
dat_datctl.options, match_data, use_dat_context);
}
}
- else if ((pat_patctl.control & CTL_JITFAST) != 0)
+ else if ((pat_patctl.control & CTL_JITFAST) != 0 &&
+ (dat_datctl.options & PCRE2_NO_JIT) == 0)
{
start_time = clock();
for (i = 0; i < timeitm; i++)
}
else
{
- if ((pat_patctl.control & CTL_JITFAST) != 0)
+ if ((pat_patctl.control & CTL_JITFAST) != 0 &&
+ (dat_datctl.options & PCRE2_NO_JIT) == 0)
PCRE2_JIT_MATCH(capcount, compiled_code, pp, arg_ulen, dat_datctl.offset,
dat_datctl.options | g_notempty, match_data, use_dat_context);
else
/* If PCRE2_COPY_MATCHED_SUBJECT was set, check that things are as they
should be, but not for fast JIT, where it isn't supported. */
- if ((dat_datctl.options & PCRE2_COPY_MATCHED_SUBJECT) != 0 &&
- (pat_patctl.control & CTL_JITFAST) == 0)
+ if ((dat_datctl.options & PCRE2_COPY_MATCHED_SUBJECT) != 0)
{
- if ((FLD(match_data, flags) & PCRE2_MD_COPIED_SUBJECT) == 0)
- fprintf(outfile,
- "** PCRE2 error: flag not set after copy_matched_subject\n");
+ if ((pat_patctl.control & CTL_JITFAST) != 0 &&
+ (dat_datctl.options & PCRE2_NO_JIT) == 0)
+ {
+ if ((FLD(match_data, flags) & PCRE2_MD_COPIED_SUBJECT) != 0)
+ fprintf(outfile,
+ "** PCRE2 error: flag set after unsupported copy_matched_subject\n");
+ }
+ else
+ {
+ if ((FLD(match_data, flags) & PCRE2_MD_COPIED_SUBJECT) == 0)
+ fprintf(outfile,
+ "** PCRE2 error: flag not set after copy_matched_subject\n");
- if (CASTFLD(const void *, match_data, subject) == pp)
- fprintf(outfile,
- "** PCRE2 error: copy_matched_subject has not copied\n");
+ if (CASTFLD(const void *, match_data, subject) == pp)
+ fprintf(outfile,
+ "** PCRE2 error: copy_matched_subject has not copied\n");
- if (memcmp(CASTFLD(const void *, match_data, subject), pp, ulen) != 0)
- fprintf(outfile,
- "** PCRE2 error: copy_matched_subject mismatch\n");
+ if (memcmp(CASTFLD(const void *, match_data, subject), pp, ulen) != 0)
+ fprintf(outfile,
+ "** PCRE2 error: copy_matched_subject mismatch\n");
+ }
}
/* If this is not the first time round a global loop, check that the